package com.weishu.controller;

import com.github.pagehelper.PageInfo;
import com.weishu.domain.Users;
import com.weishu.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/user")
public class UsersController {

    @Autowired
    private UsersService sysUserService;

    //查询出用户的列表

    @RequestMapping("list")
    public PageInfo<Users> list(@RequestBody Users sysUser){

        PageInfo<Users> info=sysUserService.list(sysUser);
        return info;
    }
    //添加
    @RequestMapping("add")
    public boolean add(@RequestBody Users sysUser){
        boolean b=sysUserService.add(sysUser);
        return b;
    }
    //删除
    @GetMapping("del")
    public boolean del(Integer userid){
        boolean dd=sysUserService.del(userid);
        return dd;
    }
    //修改
    @RequestMapping("update")
    public boolean update(@RequestBody Users sysUser){
        boolean dd=sysUserService.update(sysUser);
        return dd;
    }
    //查询管家
    @RequestMapping("getUser")
    public List<Users> getUser(){
        List<Users> list=sysUserService.getUser();
        return list;
    }
}
